<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//构造函数
			function Student(name, age) {
				//属性
				this.name = name;
				this.age = age;
				//行为
				this.study = function() {
					console.log(this.name + ",好好学习");
				}
			}
			//创建对象
			let stu1 = new Student("张三", 20);
			console.log(stu1.name);
		</script>
		<script type="text/javascript">
		    /*
			   class 类名 {
				  属性
				  constructor(name, age) {
				  	this.name = name;
				  	this.age = age;
				  }
				  
				  行为
			   }
			
			
			*/
			class Student2 {
				//构造方法
				constructor(name, age) {
					this.name = name;
					this.age = age;
				}
				study() {
					console.log(this.name + ",好好学习");
				}
				
				eat(){
					
				}
			}

			let stu2 = new Student2("李四", 30);
			console.log(stu2.name);
		</script>
	</body>
</html>
